<?php
require_once 'swiftmailer/swift_required.php';

class Email
{
	public $mailer;
	public $transport;
	public $message;
	public $errors;
	
	public function __construct()
	{
		// Create the Transport
		$this->transport = Swift_SmtpTransport::newInstance('vega.prodns.com.br', 465, 'ssl')
		  ->setUsername('contato@sindissetima.fortaltec.com.br')
		  ->setPassword('!@#$%12345');
		  
		// Create the Mailer using your created Transport
		$this->mailer = Swift_Mailer::newInstance($this->transport);
	}
	
	/**
	* @var $From array('john@doe.com' => 'John Doe')
	* @var $To array('john@doe.com' => 'John Doe')
	* @var $Subject string
	* @var $Message string
	*/
	public function enviar($To,$Subject,$Message,$From = array('contato@sindissetima.fortaltec.com.br' => 'Sindissetima - Sindicato dos Servidores do TRT 7'))
	{	//Errors
		$errors = null;
		
		// Create a message
		$this->message = Swift_Message::newInstance($Subject)
		  ->setFrom($From)
		  ->setTo($To)
		  ->setBody($Message);
		  
		// Send the message
		$result = $this->mailer->send($this->message, $errors);
		
		//Return Failures
		$this->errors = $errors;	
		
		return $result;
	}
}
//TESTE
//$teste = new Email();
//$result = $teste->enviar(array('benrainir@gmail.com' => 'Ben Rainir'), 'Assunto','Mensagem');
//var_dump($result);
?>






